<?php
class NodeSwitcher {


    var $type;  // Items in our shopping cart
    var $node;
    var $image_url;
    var $imgHtml;
    var $contentHtml;
    // Add $num articles of $artnr to the cart

    function NodeSwitcher($node,$image_url) {
        $this->type = $node->type;
        $this->node=$node;
        $this->image_url=$image_url;
        $this->getViewInfo();
    }

    // return
    function getViewInfo() {
       
         $image_root='';
         $content='';
        //========================
        switch ($this->type) {
            
            case "packages":

                $image_root = $this-> node -> field_main_image[und];
                $content = $this-> node -> body["und"][0][value];
                break;
            case "golf":
                $image_root = $this-> node -> field_golf_propertyimage[und];
               $content = $this-> node -> body["und"][0][value];
                break;
            case "page":
                $image_root = $this-> node -> field_things_to_do_propertyimage[und];
                 $content = $this-> node -> body["und"][0][value];
                break;

            case "_new_events":
                $image_root = $this-> node -> field_big_image_slides[und];
                $content = $this-> node -> field_events_description["und"][0][value];
              break;   

            case "main_menu_page_banners":
                $image_root = $this-> node -> field_image_mm_banner[und];
              break;   

            case "dining":
                $image_root = $this-> node -> field_dining_propertyimage[und];
                $content = $this-> node -> body["und"][0][value];
              break; 

            case "weddings":
                $image_root = $this-> node -> field_sliderimage[und];
                $content = $this-> node -> body["und"][0][value];
              break;

            case "webform"://item meeting
                $image_root = $this->node->field_sliderimage[und];
                $content = $this-> node -> body["und"][0][value];
              break;
            case "membership":
                $image_root = $this->node->field_member_summaryimage[und];
                $content = $this-> node -> body["und"][0][value];
              break;
            case "shopping":
                $image_root = $this->node->field_shopping_view_image[und];
                $content = $this->node -> body["und"][0][value];
              break;
            case "basic_pages":
                $image_root = $this-> node ->field_shopping_view_image[und];
                $content = $this-> node -> field_body["und"][0][value];
              break;
            case "about":
                $image_root = $this-> node ->field_about_summaryimage[und];
                $content = $this-> node -> body["und"][0][value];
              break;  

            }
        //=========================    
        
        

        $this->imgHtml= $this->processHtml($image_root); 
        $this->contentHtml= $content; 
    }


    function processHtml($image){
                    //slide pic
                    $slidenum = 0;
                    $html_string="";
                    foreach ($image as $record) { 
                        $html_string.= "<div class = 'item'>"; 
                        $html_string.= "<img src='".$this->image_url.$record[filename]."' />"; 
                        $html_string.= "</div>";
                        
                        $slidenum++;
                    }  
                    return $html_string;
                }
   function getImgHtml(){
        return $this->imgHtml;
   }

   function getContentHtml(){
        return $this->contentHtml;
   }



    }

?>